<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body></body>
</html>
<script>
    // 筛选字符串中的数字
    const str = `zheng045h45a1o7884`;
    // 常规方法
    const nums1 = [...str].filter((item) => {
        return !isNaN(item);
    });
    console.log(nums1);

    // 正则方法
    const nums2 = str.match(/\d/g);
    console.log(nums2);
</script>
